﻿@model ICDA.Web.Models.LeaveModel
@{
    ViewBag.Title = "Leave";
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#LeaveStartDate").datepicker
            ({
                dateFormat: 'dd/mm/yy',
                showStatus: true,
                showWeeks: true,
                highlightWeek: true,
                numberOfMonths: 1,
                showAnim: "scale",
                showOptions: {
                    origin: ["top", "left"]
                }
            });
        $("#LeaveEndDate").datepicker
            ({
//                onSelect: function (date) {
//                    var sdate = $("#LeaveStartDate").val();
//                    if (sdate > date) {
//                        alert("end date cant be less than start date");
//                        $("#LeaveEndDate").focus();
//                    }
//                    else if (sdate == date) {
//                        $('.DayType').show(300);
//                    }
//                    else {
//                        $('.DayType').hide();
//                    }
//                },
                dateFormat: 'dd/mm/yy',
                showStatus: true,
                showWeeks: true,
                highlightWeek: true,
                numberOfMonths: 1,
                showAnim: "scale",
                showOptions: {
                    origin: ["top", "left"]
                }
            });

        $(".tabs .tab[id^=tab_menu]").click(function () {
            debugger;
            var curMenu = $(this);
            $(".tabs .tab[id^=tab_menu]").removeClass("selected");
            curMenu.addClass("selected");

            var index = curMenu.attr("id").split("tab_menu_")[1];
            $(".curvedContainer .tabcontent").css("display", "none");
            $(".curvedContainer #tab_content_" + index).css("display", "block");
        });

//        $('#tab_menu_2').click(function () {
//            $.get('LeaveHistory', function (data) {
//                $('#tab_content_2').show();
//            });
//        });
    });
</script>
<div class="tabscontainer">
     <div class="tabs">
        <div class="tab selected first" id="tab_menu_1">
            <div class="link">LeaveApply</div>
            <div class="arrow"></div>
        </div>
        <div class="tab" id="tab_menu_2">
            <div class="link">Viewleave</div>
            <div class="arrow"></div>
        </div>
         <div class="tab last" id="tab_menu_3">
            <div class="link">EditLeave</div>
            <div class="arrow">
            </div>
        </div>
    </div>
    <div class="curvedContainer">
        <div class="tabcontent" id="tab_content_1" style="display: block">
            @using (Html.BeginForm())
            {
                @Html.ValidationSummary(true, "")
                <div class="MainContent">
                    <div class="formcontainer">
                        <div class="formtr">
                            <div class="formlabes">
                                @Html.LabelFor(m => m.LeaveStartDate)
                            </div>
                            <div class="formfield">
                                @Html.TextBoxFor(m => m.LeaveStartDate)
                                <div class="messageRow">
                                    @Html.ValidationMessageFor(m => m.LeaveStartDate)
                                </div>
                            </div>
                        </div>
                        <div class="formtr">
                            <div class="formlabes">
                                @Html.LabelFor(m => m.LeaveEndDate)
                            </div>
                            <div class="formfield">
                                @Html.TextBoxFor(m => m.LeaveEndDate)
                                <div class="messageRow">
                                    @Html.ValidationMessageFor(m => m.LeaveEndDate)
                                </div>
                            </div>
                        </div>
                        <div class="formtr">
                            <div class="formlabes">
                                @Html.LabelFor(m => m.LeaveType)
                            </div>
                            <div class="formfield">
                                @Html.RadioButtonFor(model => model.LeaveType, "Training", true) Training
                                @Html.RadioButtonFor(model => model.LeaveType, "Leave", false) Leave
                                <div class="messageRow">
                                    @Html.ValidationMessageFor(m => m.LeaveType)
                                </div>
                            </div>
                        </div>
                        <div class="formtr DayType">
                            <div class="formlabes">
                                @Html.LabelFor(m => m.DayType)
                            </div>
                            <div class="formfield">
                                @Html.RadioButtonFor(model => model.DayType, "FullDay", true) Full Day
                                @Html.RadioButtonFor(model => model.DayType, "FalfDay", false) Half Day
                                <div class="messageRow">
                                    @Html.ValidationMessageFor(m => m.DayType)
                                </div>
                            </div>
                        </div>
                        <div class="formtr">
                            <div class="formlabes">
                                @Html.LabelFor(m => m.LeaveName)
                            </div>
                            <div class="formfield">
                                @Html.TextBoxFor(m => m.LeaveName)
                                <div class="messageRow">
                                    @Html.ValidationMessageFor(m => m.LeaveName)
                                </div>
                            </div>
                        </div>
                        <div class="formtr">
                            <div class="formEditButton">
                                <button name="btnUpdate" type="submit" class="button orange medium" value="Submit">
                                    Submit</button>
                            </div>
                        </div>
                    </div>
                </div>
}
        </div>
         <div class="tabcontent" id="tab_content_2">
          <table id="table-6" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        
                        <th>
                            Leave / Training
                        </th>
                        <th>
                            Leave Start Date
                        </th>
                        <th>
                            Leave End Date
                        </th>
                        <th>
                            Day Type
                        </th>
                        <th>
                            Leave Name
                        </th>
                        <th>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null)
                    {
                        foreach (var item in Model.LeaveM)
                        {
                        <tr>
                            <td>
                                @Html.DisplayFor(modelItem => item.LeaveType)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.LeaveStartDate)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.LeaveEndDate)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.DayType)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.LeaveName)
                            </td>
                            <td>
                                @Html.ActionLink("Edit", "LeaveEdit", new { id = item.ID }) |
                                @Html.ActionLink("Delete", "DeleteLeave", new { id = item.ID })
                            </td>
                        </tr>
                        }
                    }
                </tbody>
            </table>
         </div>
        <div class="tabcontent" id="tab_content_3">content for tab 3</div>
    </div>
</div>
